package com.sh.suhe.utildemos.dialogUtils;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.sh.suhe.utildemos.R;

import butterknife.ButterKnife;
import butterknife.OnClick;


public class DialogMainActivity extends AppCompatActivity {

    //    @ViewById(R.id.main_right_but)
    Button rightBut;

    RightDialog rightDialog;
    LeftDialog leftDialog;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dialog_main);
        ButterKnife.bind(this);
    }

    @OnClick({R.id.main_title, R.id.main_right_but, R.id.main_left_but})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.main_title:
                break;
            case R.id.main_right_but:
                if (rightDialog == null) {
                    rightDialog = new RightDialog(this);
                    rightDialog.setCanceledOnTouchOutside(true);//设置点击Dialog外部任意区域关闭Dialog
                }
                if (!rightDialog.isShowing()) {
                    rightDialog.show();
                }
                break;
            case R.id.main_left_but:
                if (leftDialog == null) {
                    leftDialog = new LeftDialog(this);
                    leftDialog.setCanceledOnTouchOutside(true);//设置点击Dialog外部任意区域关闭Dialog
                }
                if (!leftDialog.isShowing()) {
                    leftDialog.show();
                }
                break;
        }
    }
}
